﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="FlashMessengerController.cs" company="">
//   Copyright (c) 2010/2011 All Right Reserved
// </copyright>
// <summary>
//   Contains FlashMessengerController class declaration.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace IBupro.Controllers
{
    using System.Web.Mvc;

    using IBupro.Classes;
    using IBupro.Controllers.Classes;
    using IBupro.Models;

    /// <summary>
    /// This controller contains actions related to flashing messages.
    /// </summary>
    public class FlashMessengerController : CustomController
    {
        public ActionResult Widget()
        {
            var model = new FlashMessengerModel
                            {
                                AnyMessages = this.FlashMessenger.HasMessages,
                                Errors = this.FlashMessenger.GetMessages(MessageType.Error),
                                Notices = this.FlashMessenger.GetMessages(MessageType.Notice),
                                Success = this.FlashMessenger.GetMessages(MessageType.Success)
                            };
            this.FlashMessenger.RemoveAllMessages();
            return PartialView(model);
        }
    }
}
